package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * @author 李旭
 * @date 2021/10/9 10:53
 * @Description:
 */
@Controller
public class ItemController {

    @Autowired
    private ItemFeignClient itemFeignClient;

    //去商品详情页面  http://item.gmall.com/100011493273.html
    @GetMapping("/{skuId}.html")
    public String getItem(@PathVariable Long skuId, Map map,Model model){
        //域 Request
        //   session  Application
        Map result = itemFeignClient.getItem(skuId);
        map.putAll(result);//
        //model.addAllAttributes()
        return "item/index";
    }

}
